home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / newconf / newport < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.5 KB  |  126 lines

  1. #!/bin/csh -f
  2. #
  3. #    to specify port info on the command line, use
  4. #
  5. #        newport TREE PORT OBJDIR
  6. #
  7. #    where TREE = root of postgres tree, PORT = name of port (sun4, dec,
  8. #    etc), and OBJDIR = name of object directory (relative to TREE).
  9. #    if any of these is the null string you will be prompted for that
  10. #    item.
  11. #
  12. set PORT = ""
  13. set OD = ""
  14. set TREE = ""
  15.  
  16. if ($1 == "-q") then
  17.     set quiet = 1
  18.     shift
  19. else
  20.     set quiet = 0
  21. endif
  22.  
  23. if ( $#argv >= 1 ) then
  24.     set TREE = $argv[1]
  25.     if ( $#argv >= 2 ) then
  26.         set PORT = $argv[2]
  27.         if ( $#argv == 3 ) then
  28.             set OD = $argv[3]
  29.         endif
  30.     endif
  31. endif
  32.  
  33. if ( $TREE == "" ) then
  34.     set confdir = `pwd`
  35.     chdir ..
  36.     set TREE = `pwd`
  37. else
  38.     set confdir = $TREE/newconf
  39.     chdir $TREE
  40. endif
  41.  
  42. if ( $PORT == "" ) then
  43.     top:
  44.     chdir $confdir/../src/port
  45.     echo "ports available are: " *
  46.     echo -n "please choose a port: "
  47.     set dir = $<
  48.     if ( $dir == "" ) goto top
  49.     if ( ! -d $dir ) then
  50.         echo "port does not exist, try again"
  51.         goto top
  52.     endif
  53.     set PORT = $dir
  54. endif
  55.  
  56. if ($quiet == 0) echo ""
  57.  
  58. chdir $TREE
  59.  
  60. if ( $OD == "" ) then
  61.     set OD = obj.$PORT
  62.     echo -n "Object directory name ($OD) ? "
  63.     set od = $<
  64.     if ( $od != "" ) set OD = $od
  65. endif
  66.  
  67. #
  68. # Make config.mk
  69. #
  70. rm -f $TREE/newconf/config.mk
  71. echo "TREE=    $TREE" > $TREE/newconf/config.mk
  72. echo "OD=    $TREE/$OD" >> $TREE/newconf/config.mk
  73. echo "SD=    $TREE/src" >> $TREE/newconf/config.mk
  74. cat $TREE/newconf/CONFIG/config.mk.$PORT >> $TREE/newconf/config.mk
  75. chmod 444 $TREE/newconf/config.mk
  76.  
  77. if ( ! -d $OD ) then
  78.     if ($quiet == 0) echo creating object directory $OD
  79.     mkdir $OD
  80. endif
  81.  
  82. # now create directories in objdir
  83. foreach i (`cat newconf/dirs.mk`)
  84.     if ($quiet == 0) echo creating $OD/$i
  85.     mkdir $OD/$i
  86. end
  87.  
  88. cat > $OD/xmake << EOF
  89. #!/bin/csh -f
  90. #
  91. # local compilation version (see dxmake for usage)
  92. #
  93. set OBJDIR = \$cwd
  94. set PORT = $PORT
  95. set GCFLAGS = -g
  96. chdir ../newconf
  97. exec Make "-dGCFLAGS=\$GCFLAGS" -dOD=\$OBJDIR -dPORTNAME=$PORT \$argv
  98. EOF
  99. chmod +x $OD/xmake
  100.  
  101. cat > $OD/lib/H/installinfo.h << EOF
  102. #ifndef INSTALLINFO_H
  103. #define INSTALLINFO_H
  104.  
  105. #define    DATAHOME "$TREE"            /* loc of data/ dir */
  106. #define    AMIINT "$TREE/$OD/support/backend"    /* for vacuumd */
  107. #define    SRCDIR "$TREE/src/support"        /* source directory */
  108. #define    SCRDIR "$TREE/$OD/support"        /* script directory */
  109.  
  110. #endif
  111. EOF
  112. chmod 444 $TREE/$OD/lib/H/installinfo.h
  113.  
  114. if ($quiet == 0) echo linking source files...
  115. chdir $TREE/newconf
  116. if ($quiet == 0) then
  117.     csh MakeLinks $TREE/$OD $TREE/src
  118. else
  119.     csh MakeLinks -q $TREE/$OD $TREE/src
  120. endif
  121.  
  122. if (! -e $TREE/newconf/newport.stat) then
  123.     touch $TREE/newconf/newport.stat
  124.     chmod 444 $TREE/newconf/newport.stat
  125. endif
  126.